Skip to content

feat: setup basedpyright #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 25 commits into
base: master
Choose a base branch
from
Draft

feat: setup basedpyright #10

wants to merge 25 commits into from

Conversation

Paillat-dev
Copy link
Member

In an effort to have better typing, this sets up basedpyright with the "baseline" feature, which will ignore all typing errors from before this pull request and allow for gradual typing of code. Idk if this is the best, but I figured I might as well try. This needs #4 to be merged first.

@Paillat-dev Paillat-dev force-pushed the setup-basedpyright branch from ba45351 to 31089b1 Compare May 30, 2025 06:59
@Paillat-dev Paillat-dev requested a review from Copilot May 30, 2025 10:01
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request adds a basedpyright CI job with a “baseline” configuration and modernizes type annotations across the codebase by replacing Union[...] with the new | syntax, plus a couple of strict-parameter adjustments in zip calls.

  • Introduce basedpyright run in GitHub Actions for gradual typing
  • Replace typing.Union annotations with PEP 604-style unions (A | B)
  • Add explicit strict=False to zip in two methods (though default is already False)
  • Update changelog to note removal of Python 3.9 support

Reviewed Changes

Copilot reviewed 38 out of 38 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
discord/state.py Updated Channel union syntax; added strict=False to zip in _delay_ready
discord/role.py Added strict=False to zip in _move payload comprehension
discord/object.py Updated SupportsIntCast alias to PEP 604 union syntax
discord/message.py Modernized EmojiInputType to use `
discord/member.py Replaced VocalGuildChannel Union with `
discord/iterators.py Replaced internal _Func return union with `
discord/invite.py Swapped out Union[...] for TypeAlias-style unions
discord/interactions.py Modernized InteractionChannel union syntax
discord/guild.py Converted channel-type aliases to PEP 604 unions
discord/ext/commands/flags.py Adjusted optional flag handling; removed import of Union
discord/ext/commands/context.py Updated BotT bound to `Bot
discord/ext/commands/_types.py Converted many Union-based definitions to `
discord/ext/bridge/context.py Simplified Context union to `
discord/errors.py Replaced _ResponseType union with PEP 604 syntax
discord/commands/options.py Refactored InputType to new union grouping syntax
discord/commands/core.py Marked deprecated Union[...] usage with TODO and noqa
discord/activity.py Updated ActivityTypes to use PEP 604 unions
discord/abc.py Cleaned up MessageableChannel and SnowflakeTime aliases
CHANGELOG-V3.md Noted removal of Python 3.9 support
.github/workflows/lib-checks.yml Added basedpyright job to CI workflow
Comments suppressed due to low confidence (1)

discord/ext/commands/flags.py:421

  • You removed the Union import at the top but still reference Union here, which will cause a NameError. Re-import Union or replace this with the modern | syntax.
annotation = Union[annotation.__args__[:-1]]  # noqa: UP007

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants